home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / vidbasic.zip / VDATA.ASM < prev    next >
Assembly Source File  |  1990-11-29  |  3KB  |  103 lines

  1. ;«RM82»«TS8,16,24,32,40,48,56,64»
  2. ; Updated 11/20/90
  3.  
  4. ;============================================================================
  5. ;   Copyright (C) Copr. 1990 by Sidney J. Kelly
  6. ;           All Rights Reserved.
  7. ;           Sidney J. Kelly
  8. ;           150 Woodhaven Drive
  9. ;           Pittsburgh, PA 15228
  10. ;           home phone 412-561-0950 (7pm to 9:30pm EST)
  11. ;============================================================================
  12.  
  13. ;===========================================================================
  14. ; Important information for my set of video routines
  15. ;===========================================================================
  16.  
  17. DOSSEG
  18. .MODEL MEDIUM
  19. PUBLIC B$DVIDEOINSTL, B$DVIDEOSEG, B$DVIDEOPORT, B$DVIDEODI, Get_Adapter, SET_DI
  20.  
  21. .DATA
  22.     EVEN
  23.     B$DVIDEOSEG     DW      0       ;current video segment
  24.     B$DVIDEOPORT    DW    0    ;retrace port if CGA
  25.     B$DVIDEODI      DW      0       ;current offset inside video segment
  26.     B$DVIDEOINSTL   DB      0       ;records if Get_Adapter run
  27. .code
  28.  
  29. INCLUDE NOWAIT.INC
  30.  
  31. Copyright       DB    13,10,'Copyright Copr. (C) 1990 Sidney J. Kelly',13,10
  32. Copyright1      DB    'All Rights Reserved',13,10,26
  33.  
  34. ;===========================================================================
  35. ;Purpose:
  36. ;       Called as a subroutine to find display adapter attached
  37. ;          sets the above information segment to reflect that information
  38. ;Destroys: Nothing
  39. ;Returns:  Nothing
  40. ;       Above Data Area Filed
  41. ;Routine assumes that if you have an EGA or VGA, it is active.
  42. ;  This could produce snow if EGA were a secondary display acting as
  43. ;  a mono monitor, with CGA active. Not done because routine would become
  44. ;  bloated to handle unusual case.
  45. ;===========================================================================
  46.  
  47. EVEN
  48. Get_Adapter    PROC    FAR
  49.     Push    BP            ;save everthing we use
  50.     Push    AX
  51.     Push    BX
  52.     Push    DX
  53.     Push    ES
  54.  
  55.     Xor    DX,DX         ;zero out DX  (also sets DX for no CGA)
  56.     Mov    ES,DX         ;put the zero in ES, to look at low memory
  57.     Mov    BX,0B000h     ;assume the Mono screen segment
  58.     Mov    AL,ES:[463h]  ;look at the video controller port address
  59.     Cmp    AL,0B4h       ;is it mono?
  60.     JZ     All_Done      ;yes, skip over adding 800h to video segment
  61.     Add    BX,800h       ;no, adjust BX for a color monitor
  62.     Push    BX            ;and save it because the EGA test destroys BX
  63.  
  64.     Mov    AH,12h        ;specify EGA BIOS EGA special function service
  65.     Mov    BL,10h        ;request EGA info
  66.     Int    10h           ;call the BIOS
  67.     Cmp    BL,10h        ;if BL is still 10h, there's no EGA
  68.     JNE    Color_EGA     ;it is an EGA, skip ahead
  69.     Mov    DX,3DAh       ;not EGA, specify port to check for retrace
  70.  
  71. Color_EGA:
  72.     Pop    BX            ;get the video segment again
  73.  
  74. All_Done:
  75.     Mov    B$DVIDEOSEG,   BX  ;Store the information we found
  76.     Mov    B$DVIDEOPORT,  DX
  77.     Mov    B$DVIDEOINSTL, 1   ;Note that routine is installed
  78.  
  79.         Pop    ES
  80.         Pop    DX
  81.         Pop    BX
  82.     Pop    AX
  83.     Pop    BP
  84.     Ret
  85. Get_Adapter ENDP
  86.  
  87. ;=============================================================================
  88. ;Call SET_DI
  89. ; A public subroutine that fixes DI 
  90. ; Setup for 80 column display because that is all QBASIC supports
  91. ;
  92. ; Input:     DH = Row :  DL = Column
  93. ; Output:    DI = Memory Offset
  94. ; Destroys:  CX
  95. ;=============================================================================
  96.  
  97. EVEN
  98. SET_DI    PROC FAR
  99.     Set_DI_Offset      ;call macro to find video seg offset in DI
  100.     Ret
  101. SET_DI    ENDP
  102. END
  103.